﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MoiQuanHe.aspx.cs" Inherits="MoiQuanHe" %>

<%@ Register Assembly="Infragistics4.WebUI.WebResizingExtender.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI" TagPrefix="igui" %>
<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="~/Styles/DivTable.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">

        //Event when a row of ChuDauTu selected
        function onRowSelectionChanged(wdg, evntArgs) {
            //Get value from row selected
            var selectedID = evntArgs.getSelectedRows().getItem(0).get_cell(0).get_text();
            var selectedSurName = evntArgs.getSelectedRows().getItem(0).get_cell(2).get_text();
            var selectedName = evntArgs.getSelectedRows().getItem(0).get_cell(3).get_text();
            var selectedAddress = evntArgs.getSelectedRows().getItem(0).get_cell(4).get_text();
            var selectedMobile = evntArgs.getSelectedRows().getItem(0).get_cell(5).get_text();
            var selectedPosition = evntArgs.getSelectedRows().getItem(0).get_cell(6).get_text();
            var selectedCharacter = evntArgs.getSelectedRows().getItem(0).get_cell(7).get_text();

            document.getElementById("txtMaMoiQH").value = selectedID;
            document.getElementById("txtHo").value = selectedSurName;
            document.getElementById("txtName").value = selectedName;
            document.getElementById("txtDiaChi").value = selectedAddress;
            document.getElementById("txtDienThoai").value = selectedMobile;
            document.getElementById("txtChucDanh").value = selectedPosition;
            document.getElementById("txtTinhCach").value = selectedCharacter;

            // Set selected value for ChuDauTu of parent page
            opener.document.getElementById("txtMoiQH").value = selectedID;
        }
    </script>
    <style type="text/css">
        .CellTitle
        {
            width: 271px;
        }
        .CellContent
        {
            width: 64px;
        }
        .CellTitle
        {
            float: left;
            display: table-column;
            width: 132px;
            text-align: right;
        }
        .CellContent
        {
            width: 11px;
        }
        .style1
        {
            float: left;
            display: table-column;
            align: right;
            width: 160px;
        }
        .style2
        {
            float: left;
            display: table-column;
            width: 201px;
            text-align: right;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True"
        AsyncPostBackTimeout="300" />
    <table class="Main" style="width: 100%;">
        <tr>
            <td colspan="4" align="center">
                <h1>
                    THÔNG TIN MỐI QUAN HỆ</h1>
            </td>
        </tr>
        <tr>
            <td class="CellTitle" colspan="1">
                Mã:
            </td>
            <td class="CellContent" colspan="3">
                <asp:TextBox ID="txtMaMoiQH" runat="server" Enabled="False" 
                    style="margin-left: 0px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="CellTitle">
                Họ:
            </td>
            <td class="style1">
                <asp:TextBox ID="txtHo" runat="server" TabIndex="1"></asp:TextBox>
            </td>
            <td class="style2">
                Tên:
            </td>
            <td class="CellContent">
                <asp:TextBox ID="txtName" runat="server" TabIndex="2"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="CellTitle">
                Địa chỉ:
            </td>
            <td class="style1">
                <asp:TextBox ID="txtDiaChi" runat="server" TabIndex="3"></asp:TextBox>
                <%--<ig:WebDropDown ID="wddPackage" runat="server" Width="155px" 
                        ondatabound="wddPackage_DataBound">
                    </ig:WebDropDown>--%>
            </td>
            <td class="style2">
                Điện thoại:
            </td>
            <td class="CellContent">
                <asp:TextBox ID="txtDienThoai" runat="server" TabIndex="4"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="CellTitle">
                Chức danh:
            </td>
            <td class="style1">
                <asp:TextBox ID="txtChucDanh" runat="server" TabIndex="5"></asp:TextBox>
            </td>
            <td class="style2">
                Tính cách:
            </td>
            <td colspan="3" class="CellContent">
                <asp:TextBox ID="txtTinhCach" runat="server" TabIndex="6"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center">
                <ig:WebDataGrid ID="wdgMoiQH" runat="server" AutoGenerateColumns="False" DataKeyFields="representative_id"
                    Height="191px" Width="823px">
                    <Columns>
                        <ig:BoundDataField DataFieldName="representative_id" Key="representative_id" Header-Text="ID">
                            <Header Text="Mã MQH"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="investor_id" Key="investor_id" Header-Text="ID">
                            <Header Text="Mã chủ đầu tư"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="first_name" Key="first_name" Header-Text="Họ">
                            <Header Text="Họ"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="last_name" Key="last_name" Header-Text="Tên">
                            <Header Text="Tên"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="address_MQH" Key="address_MQH" Header-Text="Địa chỉ">
                            <Header Text="Địa chỉ"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="phone_INT" Key="phone_INT" Header-Text="Điện thoại">
                            <Header Text="Điện thoại"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="position" Key="position" Header-Text="Chức danh">
                            <Header Text="Chức danh"></Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="caracter" Key="caracter" Header-Text="Tính cách">
                            <Header Text="Tính cách"></Header>
                        </ig:BoundDataField>
                    </Columns>
                    <Behaviors>
                        <ig:Activation>
                        </ig:Activation>
                        <ig:Selection CellClickAction="Row" RowSelectType="Single">
                            <AutoPostBackFlags RowSelectionChanged="true" />
                            <SelectionClientEvents RowSelectionChanged="onRowSelectionChanged" />
                        </ig:Selection>
                        <ig:ColumnResizing>
                            <ColumnSettings>
                                <ig:ColumnResizeSetting ColumnKey="investor_id" MaximumWidth="200" MinimumWidth="50" />
                            </ColumnSettings>
                        </ig:ColumnResizing>
                        <ig:EditingCore>
                            <Behaviors>
                                <ig:CellEditing>
                                </ig:CellEditing>
                            </Behaviors>
                        </ig:EditingCore>
                    </Behaviors>
                </ig:WebDataGrid>
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center">
                <asp:Button ID="btnAdd" runat="server" Text="Thêm" TabIndex="7" 
                    OnClick="btnAdd_Click">
                </asp:Button>
                <asp:Button ID="btnEdit" runat="server" Text="Sửa" TabIndex="8" 
                    OnClick="btnEdit_Click">
                </asp:Button>
                <asp:Button ID="btnSelect" runat="server" Text="Chọn" TabIndex="9" 
                    OnClick="btnSelect_Click">
                </asp:Button>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
